package com.hqyj.shop.service.imp;

import com.hqyj.shop.dao.CartDao;
import com.hqyj.shop.pojo.Cart;
import com.hqyj.shop.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartServiceImpl implements CartService {
    @Autowired
    private CartDao cartDao;

    @Override
    public boolean addCartOne(Integer userId, Integer goodsId) {
        boolean b=cartDao.addCartOne(userId,goodsId);
        return b;
    }

    @Override
    public List<Cart> queryCartByName(String username) {
        List<Cart> result=cartDao.queryAllShopCart(username);
        return result;
    }

    @Override
    public boolean deleteOneOnCart(Integer cardId) {
        boolean b = cartDao.deleteOneOnCart(cardId);
        return b;
    }

    @Override
    public boolean updateOneGoodsNum(Integer cardId,Integer number) {
        boolean b=cartDao.updateOneGoodsNum(cardId,number);
        return b;
    }
}
